package com.example.demo.config;

import com.example.demo.model.ReaderResp;
import com.example.demo.utils.JacksonUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/**
 * @author Liunh
 */
@Component
@Slf4j
public class ImportExcelListener {

    @EventListener
    public void handleReaders(ImportExcelEvent<ReaderResp> importExcelEvent) {
        log.info("导入读者:{}", JacksonUtil.beanToJson(importExcelEvent.getDto()));
    }

    @EventListener
    public void handleBooks(ImportExcelEvent importExcelEvent) {
        log.info("导入图书:{}", importExcelEvent.getDto());
    }

    @EventListener
    public void handleLoans(ImportExcelEvent importExcelEvent) {
        log.info("导入借阅记录:{}", importExcelEvent.getDto());
    }



}
